Implement a group_by_owners function¶
Accepts a dictionary containing the file owner name for each file name.
Returns a dictionary containing a list of file names for each owner name, in any order.
Example: for dictionary
{‘Input.txt’: ‘Randy’, ‘Code.py’: ‘Stan’, ‘Output.txt’: ‘Randy’}
the group_by_owners function should return
{‘Randy’: [‘Input.txt’, ‘Output.txt’], ‘Stan’: [‘Code.py’]}.
class FileOwners:
@staticmethod
def group_by_owners(files):
return None
files = {
'Input.txt': 'Randy',
'Code.py': 'Stan',
'Output.txt': 'Randy'
}
Test:
print(FileOwners.group_by_owners(files))